package com.eshop.pcresult;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;

@ApiModel(value = "Result", description = "通用请求返回数据")
public class Result<T>
{
    @ApiModelProperty("返回编码code")
    private String code;
    @ApiModelProperty("返回数据data")
    private T data;
    @ApiModelProperty("错误数据")
    private Object errorData;
    @ApiModelProperty("返回信息")
    private String message;
    private String name;
    private String describe;
    private String json;
    
    public Result() {
        this.code = "";
        this.message = "";
    }
    
    public Result(final T data) {
        this.code = "";
        this.data = data;
    }
    
    public Result(final T data, final String name, final String describe, final String json) {
        this.code = "";
        this.data = data;
        this.name = name;
        this.describe = describe;
        this.json = json;
    }
    
    public Result(final String name, final String describe, final String json) {
        this.code = "";
        this.message = "";
        this.name = name;
        this.describe = describe;
        this.json = json;
    }
    
    public Result(final T data, final String code) {
        this.code = code;
        this.message = CoReturnFormat.getMessage(code);
        this.data = data;
    }
    
    public Result(final T data, final String code, final String name, final String describe, final String json) {
        this.code = code;
        this.message = CoReturnFormat.getMessage(code);
        this.data = data;
        this.name = name;
        this.describe = describe;
        this.json = json;
    }
    
    public Result(final String code, final Object data) {
        this.code = code;
        this.message = CoReturnFormat.getMessage(code);
        this.errorData = data;
    }
    
    public Result(final String code) {
        this.code = code;
        this.message = CoReturnFormat.getMessage(code);
    }
    
    public Result(final String code, final String name, final String describe, final String json) {
        this.code = code;
        this.message = CoReturnFormat.getMessage(code);
        this.name = name;
        this.describe = describe;
        this.json = json;
    }
    
    public String getCode() {
        return this.code;
    }
    
    public T getData() {
        return this.data;
    }
    
    public Object getErrorData() {
        return this.errorData;
    }
    
    public String getMessage() {
        return this.message;
    }
    
    public String getName() {
        return this.name;
    }
    
    public String getDescribe() {
        return this.describe;
    }
    
    public String getJson() {
        return this.json;
    }
    
    public void setCode(final String code) {
        this.code = code;
    }
    
    public void setData(final T data) {
        this.data = data;
    }
    
    public void setErrorData(final Object errorData) {
        this.errorData = errorData;
    }
    
    public void setMessage(final String message) {
        this.message = message;
    }
    
    public void setName(final String name) {
        this.name = name;
    }
    
    public void setDescribe(final String describe) {
        this.describe = describe;
    }
    
    public void setJson(final String json) {
        this.json = json;
    }
    
    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof Result)) {
            return false;
        }
        final Result<?> other = (Result<?>)o;
        if (!other.canEqual(this)) {
            return false;
        }
        final Object this$code = this.getCode();
        final Object other$code = other.getCode();
        Label_0065: {
            if (this$code == null) {
                if (other$code == null) {
                    break Label_0065;
                }
            }
            else if (this$code.equals(other$code)) {
                break Label_0065;
            }
            return false;
        }
        final Object this$data = this.getData();
        final Object other$data = other.getData();
        Label_0102: {
            if (this$data == null) {
                if (other$data == null) {
                    break Label_0102;
                }
            }
            else if (this$data.equals(other$data)) {
                break Label_0102;
            }
            return false;
        }
        final Object this$errorData = this.getErrorData();
        final Object other$errorData = other.getErrorData();
        Label_0139: {
            if (this$errorData == null) {
                if (other$errorData == null) {
                    break Label_0139;
                }
            }
            else if (this$errorData.equals(other$errorData)) {
                break Label_0139;
            }
            return false;
        }
        final Object this$message = this.getMessage();
        final Object other$message = other.getMessage();
        Label_0176: {
            if (this$message == null) {
                if (other$message == null) {
                    break Label_0176;
                }
            }
            else if (this$message.equals(other$message)) {
                break Label_0176;
            }
            return false;
        }
        final Object this$name = this.getName();
        final Object other$name = other.getName();
        Label_0213: {
            if (this$name == null) {
                if (other$name == null) {
                    break Label_0213;
                }
            }
            else if (this$name.equals(other$name)) {
                break Label_0213;
            }
            return false;
        }
        final Object this$describe = this.getDescribe();
        final Object other$describe = other.getDescribe();
        Label_0250: {
            if (this$describe == null) {
                if (other$describe == null) {
                    break Label_0250;
                }
            }
            else if (this$describe.equals(other$describe)) {
                break Label_0250;
            }
            return false;
        }
        final Object this$json = this.getJson();
        final Object other$json = other.getJson();
        if (this$json == null) {
            if (other$json == null) {
                return true;
            }
        }
        else if (this$json.equals(other$json)) {
            return true;
        }
        return false;
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof Result;
    }
    
    @Override
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $code = this.getCode();
        result = result * 59 + (($code == null) ? 43 : $code.hashCode());
        final Object $data = this.getData();
        result = result * 59 + (($data == null) ? 43 : $data.hashCode());
        final Object $errorData = this.getErrorData();
        result = result * 59 + (($errorData == null) ? 43 : $errorData.hashCode());
        final Object $message = this.getMessage();
        result = result * 59 + (($message == null) ? 43 : $message.hashCode());
        final Object $name = this.getName();
        result = result * 59 + (($name == null) ? 43 : $name.hashCode());
        final Object $describe = this.getDescribe();
        result = result * 59 + (($describe == null) ? 43 : $describe.hashCode());
        final Object $json = this.getJson();
        result = result * 59 + (($json == null) ? 43 : $json.hashCode());
        return result;
    }
    
    @Override
    public String toString() {
        return "Result(code=" + this.getCode() + ", data=" + this.getData() + ", errorData=" + this.getErrorData() + ", message=" + this.getMessage() + ", name=" + this.getName() + ", describe=" + this.getDescribe() + ", json=" + this.getJson() + ")";
    }
}
